<!DOCTYPE html>
<html>
<head>
    <title>Basic usage</title>

    <link href="../../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../../styles/kendo.default.min.css" rel="stylesheet">

    <script src="../../../js/jquery.min.js"></script>
    <script src="../../../js/kendo.web.min.js"></script>
    <script src="../../content/shared/js/console.js"></script>
</head>
<body>
    <a class="offline-button" href="../index.html">Back</a>
    
        <div id="example" class="k-content">
        <div id="cap-view" class="demo-section">
            <h2>Customize your Kendo Cap</h2>
            <div id="cap" class="black-cap"></div>
            <div id="options">
            <h3>Cap Color</h3>
            <input id="color" value="1" />

            <h3>Cap Size</h3>
            <select id="size">
                <option>S - 6 3/4"</option>
                <option>M - 7 1/4"</option>
                <option>L - 7 1/8"</option>
                <option>XL - 7 5/8"</option>
            </select>

            <button class="k-button" id="get">Customize</button>
            </div>
        </div>
        <style scoped>
            .demo-section {
		width: 460px;
		height: 300px;
		padding: 30px;
            }
            .demo-section h2 {
		text-transform: uppercase;
		font-size: 1.2em;
		margin-bottom: 30px;
            }
            #cap {
                float: left;
                width: 242px;
                height: 225px;
                margin: 20px 30px 30px 0;
                background-image: url('../../content/web/dropdownlist/cap.png');
                background-repeat: no-repeat;
                background-color: transparent;
            }
            .black-cap {
                background-position: 0 0;
            }
            .grey-cap {
                background-position: 0 -225px;
            }
            .orange-cap {
                background-position: 0 -450px;
            }
            #options {
                padding: 1px 0 30px 30px;
            }
            #options h3 {
                font-size: 1em;
                font-weight: bold;
                margin: 25px 0 8px 0;
            }
            #get {
                margin-top: 25px;
            }
        </style>

            <script>
                $(document).ready(function() {
                    var data = [
                        { text: "Black", value: "1" },
                        { text: "Orange", value: "2" },
                        { text: "Grey", value: "3" }
                    ];

                    // create DropDownList from input HTML element
                    $("#color").kendoDropDownList({
                        dataTextField: "text",
                        dataValueField: "value",
                        dataSource: data,
                        index: 0,
                        change: onChange
                    });

                    // create DropDownList from select HTML element
                    $("#size").kendoDropDownList();

                    var color = $("#color").data("kendoDropDownList");

                    color.select(0);
                    var size = $("#size").data("kendoDropDownList");

                    function onChange() {
                        var value = $("#color").val();
                        $("#cap")
                            .toggleClass("black-cap", value == 1)
                            .toggleClass("orange-cap", value == 2)
                            .toggleClass("grey-cap", value == 3);
                    };

                    $("#get").click(function() {
                        alert('Thank you! Your Choice is:\n\nColor ID: '+color.value()+' and Size: '+size.value());
                    });
                });
            </script>
        </div>

</body>
</html>
